package database

import (
	"dustbe/util"
	"fmt"
	"os"

	"github.com/neo4j/neo4j-go-driver/v5/neo4j"
)

var (
	neo4jPath    string = "./config/neo4j.json"
	Neo4jDriver  neo4j.DriverWithContext
)

func init() {
	neo4jPathExist, _ := util.CheckFilePath(neo4jPath)
	if !util.Debug && !neo4jPathExist {
		fmt.Printf("neo4j config %s is not exist!\n", neo4jPath)
		os.Exit(-1)
	}
	Neo4jDriver = CreateNeo4jDriver()
	fmt.Println("neo4j is connected!")
}

